<!DOCTYPE html>
<html lang="en" style="font-size: 10px">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            font-size: 5rem;
            outline: 1px solid red;
        }
    </style>
</head>
<body>
    <div class="box">hello world</div>

    <script>

        window.addEventListener('resize', () => {
            const vw = window.innerWidth;
            console.log(vw);
            document.documentElement.setAttribute('style', `font-size: ${ .01 * vw }px;`);
        });

    </script>
</body>
</html>